// 导入路由插件
import VueRouter from 'vue-router'
import Vue from 'vue'

// 使用插件 - 重要
Vue.use(VueRouter)

// 导入组件

import MyHome from '../47.路由/views/MyHome.vue'
import MyMovie from '../47.路由/views/MyMovie.vue'
import MyNews from '../47.路由/views/MyNews.vue'
import Page404 from '../47.路由/views/page404.vue'




// 创建路由规则
const router = new VueRouter({
  routes: [
    {
      path:"/",
      redirect:"/MyHome"
    },
    
    {
      path: "/MyHome", // 当浏览器访问 http://localhost:8080/#/MyHome时，
      component: MyHome  // 装入组件 MyHome
    },
    {
      path: "/MyMovie",
      component: MyMovie
    }, 
    {
      
      path: "/MyNews/:id",
      component: MyNews,
      name:'news'
    },
    {
      path:"*",
      component:Page404
    }
  ]
})

export default router